Slow loop question

Hi,

I was searching for something else, saw something of interest and now cannot find it again.

It was a post about how the for object in entire module do loop (I think) was infamous for slowness. Someone posted there was a way around the problem by using skip lists. Does any of this make sense? I'm trying to optimize some code and thought this might be of help. I didn't really understand what the post said and could not afford the time to study it (at the time).

Does this ring a bell with anyone?

Any help will be greatly appreciated.

Best,
Frank
lanef - Thu Feb 14 10:12:40 EST 2013

Re: Slow loop question
SystemAdmin - Thu Feb 14 11:53:06 EST 2013

The "for Object in entire(Module) do" loop is not slow.
What can make it slow is what you do in the loop.
Looping and filling a Skip followed by looping the Skip will be slower.

Re: Slow loop question
lanef - Thu Feb 14 13:21:30 EST 2013

SystemAdmin - Thu Feb 14 11:53:06 EST 2013
The "for Object in entire(Module) do" loop is not slow.
What can make it slow is what you do in the loop.
Looping and filling a Skip followed by looping the Skip will be slower.

Thank you and that makes sense, you'd basically be looping the same objects twice. I obviously must have grossly misunderstood the post I skimmed.

Best,
Frank

Re: Slow loop question
llandale - Thu Feb 14 15:13:27 EST 2013

The loop is not particulary slow, but is very slow if you figure to do it many many times; such as looking for a particular object with a particular object ID. So if you are in need to do such things; the Skip list approach is far faster:

Skip skpObjects = createString()
for o in entire mod do {put(skpObjects, identifier(o), o)}
 
body:
  if (find(skpObjects, identifier(oTarget), oTarget)) then process oTarget
delete(skpObjects)


-Louie

Re: Slow loop question
lanef - Thu Feb 14 19:11:47 EST 2013

llandale - Thu Feb 14 15:13:27 EST 2013

The loop is not particulary slow, but is very slow if you figure to do it many many times; such as looking for a particular object with a particular object ID. So if you are in need to do such things; the Skip list approach is far faster:

Skip skpObjects = createString()
for o in entire mod do {put(skpObjects, identifier(o), o)}
 
body:
  if (find(skpObjects, identifier(oTarget), oTarget)) then process oTarget
delete(skpObjects)


-Louie

Thank you Louie!